import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';

import { JhiEventManager } from 'ng-jhipster';

import { BsModalRef } from 'ngx-bootstrap/modal'


import { IDeliverOffer } from 'app/shared/model/deliver-offer.model';
import { DeliverOfferService } from './deliver-offer.service';

@Component({
    selector: 'app-deliver-offer-delete-dialog',
    templateUrl: './deliver-offer-delete-dialog.component.html'
})
export class DeliverOfferDeleteDialogComponent {
    deliverOffer: IDeliverOffer;

    constructor(
        private deliverOfferService: DeliverOfferService,
        public bsModalRef: BsModalRef,
        private eventManager: JhiEventManager
    ) {}

    clear() {
        this.bsModalRef.hide();
    }

    confirmDelete(id: number) {
        this.deliverOfferService.delete(id).subscribe(response => {
            this.eventManager.broadcast({
                name: 'deliverOfferListModification',
                content: 'Deleted an deliverOffer'
            });
            this.bsModalRef.hide();
        });
    }
}
